﻿
/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：吕海乐 
    //
    // 文件名：GoodsSelect.cs
    // 文件功能描述：采购产品选择页面
    // 创建标识：吕海乐2009-03-31
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
// 审核时间：
// 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Collections.Generic;
using HZ.DrugTrade.Web;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;

namespace HZ.DrugTrade.Web.Admin.BidProdManage
{
    public partial class GoodsSelect : BasePage
    {
        public GoodsSelect()
        { 
        
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetBind();
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            SetBind();
        }

        /// <summary>
        /// 
        /// </summary>
        private void SetBind()
        { 
           //获取产品查询条件
            Model.Query.Goods goods=new HZ.DrugTrade.Model.Query.Goods();
            goods.CompanyName_SC = txtProduceCompany_SC.Text.Trim();
            goods.GoodsName = txtGoodsName.Text.Trim();
            goods.SortFields = "GoodsID";
            //调用方法，执行查询，分页显示
           // AspNetPager1.PageSize = 10;
            int totalCount = 0;
            try
            {
                IBLL_Goods ig = Factory.BLL_Goods();
                IList<Model.View.Goods> goodsList = ig.GetAllGoodsByWhere(goods, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount);
                AspNetPager1.RecordCount = totalCount;
                gvwGoodsInfo.DataSource = goodsList;
                gvwGoodsInfo.DataBind();
            }
            catch (Exception ex)
            {
                PageError(ex.Message, "");
            }
            
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            SetBind();
        }

        /// <summary>
        /// 选择产品，转向添加页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            string ids = Request["checkbox1"].ToString();
            HZ.Web.WebUtil.RedirectByScript("BidProductAdd.aspx?goodsid="+ids);
        }
    }
}
